Index: trunk/gcc/tree-data-ref.c
===================================================================
--- trunk/gcc/tree-data-ref.c (revision 126419)
+++ trunk/gcc/tree-data-ref.c (working copy)
@@ -566,6 +566,25 @@ split_constant_offset (tree exp, tree *v
  return;
       }
 
+    case SSA_NAME:
+      {
+         tree def_stmt = SSA_NAME_DEF_STMT (exp);
+    if (TREE_CODE (def_stmt) == GIMPLE_MODIFY_STMT)
+           {
+             tree def_stmt_rhs = GIMPLE_STMT_OPERAND (def_stmt, 1);
+             if (!TREE_SIDE_EFFECTS (def_stmt_rhs)
+                 && EXPR_P (def_stmt_rhs))
+               {
+                 split_constant_offset (def_stmt_rhs, &var0, &off0);
+                 var0 = fold_convert (type, var0);
+                 *var = var0;
+                 *off = off0;
+                 return;
+               }
+           }
+        break;
+      }
+
     default:
       break;
     }

--- ./gcc/tree-vect-transform.c.orig	2007-07-14 17:48:31.000000000 +0100
+++ ./gcc/tree-vect-transform.c	2007-07-14 18:00:20.000000000 +0100
@@ -798,9 +798,10 @@
   stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
   struct data_reference *dr = STMT_VINFO_DATA_REF (stmt_info);
   struct loop *containing_loop = (bb_for_stmt (stmt))->loop_father;
-  tree data_ref_base = unshare_expr (DR_BASE_ADDRESS (dr));
-  tree base_name;
-  tree vec_stmt;
+  tree data_ref_base_expr = unshare_expr (DR_BASE_ADDRESS (dr));
+  tree data_ref_base_var;  
+  tree data_ref_base;  
+  tree new_base_stmt;
   tree addr_base, addr_expr;
   tree dest, new_stmt;
   tree base_offset = unshare_expr (DR_OFFSET (dr));
@@ -820,13 +821,20 @@
       base_offset = unshare_expr (STMT_VINFO_DR_OFFSET (stmt_info));
       init = unshare_expr (STMT_VINFO_DR_INIT (stmt_info));
     }
- 
+
+  /* Create data_ref_base */
+  data_ref_base_var = create_tmp_var (TREE_TYPE (data_ref_base_expr), "batmp");
+  add_referenced_var (data_ref_base_var);
+  data_ref_base = force_gimple_operand (data_ref_base_expr, &new_base_stmt,
+ true, data_ref_base_var);
+  append_to_statement_list_force(new_base_stmt, new_stmt_list);
+
   /* Create base_offset */
-  base_name = build_fold_indirect_ref (data_ref_base);
   base_offset = size_binop (PLUS_EXPR, base_offset, init);
+  base_offset = fold_convert (sizetype, base_offset);
   dest = create_tmp_var (TREE_TYPE (base_offset), "base_off");
   add_referenced_var (dest);
-  base_offset = force_gimple_operand (base_offset, &new_stmt, false, dest);  
+  base_offset = force_gimple_operand (base_offset, &new_stmt, true, dest);  
   append_to_statement_list_force (new_stmt, new_stmt_list);
 
   if (offset)
